<?php if (!defined('SERVER_ROOT')) exit('No direct script access allowed');

class phucapuudai_Controller extends Controller {

    function __construct(){
        parent::__construct('quanlyluong', 'phucapuudai');
        $this->check_login();
        $this->view->template->menu_html =$this->CREATE_MENU();
        $this->view->template->nhacviec_html =$this->CREATE_NHAC_VIEC(); 
        $this->CHECK_QUYEN('quanlyluong', 'phucapuudai');
    }

    function main(){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $this->dsp_all_phucapuudai();
    }
    function dsp_all_phucapuudai(){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $VIEW_DATA['arr_all_phucapuudai']     = $this->model->qry_all_phucapuudai();
        $this->view->render('dsp_all_phucapuudai', $VIEW_DATA);
    }
    public function dsp_single_phucapuudai($MA_PHU_CAP_UU_DAI){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $MA_PHU_CAP_UU_DAI = replace_bad_char($MA_PHU_CAP_UU_DAI);
        $VIEW_DATA['arr_single_phucapuudai'] = $this->model->qry_single_phucapuudai($MA_PHU_CAP_UU_DAI);
        $VIEW_DATA['arr_all_chucvu'] = $this->model->SELECT_CHUCVU_nothing();
        $this->view->render('dsp_single_phucapuudai', $VIEW_DATA);
    }
    public function update_phucapuudai(){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $this->model->goback_url = $this->view->get_controller_url() . 'dsp_all_phucapuudai';
        $this->model->update_phucapuudai();
    }
    public function delete_phucapuudai(){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $this->model->goback_url = $this->view->get_controller_url() . 'dsp_all_phucapuudai';
        $this->model->delete_phucapuudai();
    }
}